package com.jbxie.spaceiotmqtt;

import com.jbxie.spaceiotmqtt.mqttUtils.MyMqttClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class IotMqttMain {
    public static void main(String[] args) {
        String broker = "tcp://192.168.31.198:1883";
//        MyMqttClient mqttClient_sub = new MyMqttClient();
//        MyMqttClient mqttClient_pub = new MyMqttClient();
//
//        mqttClient_sub.createClient(broker);
//        mqttClient_pub.createClient(broker);
//
//        mqttClient_pub.pubMessage("world/test1", "hello:test_1", 1);
//        mqttClient_sub.subTopic("world/test1");

        MyMqttClient mqttClient = new MyMqttClient();
        mqttClient.createClient(broker);
        mqttClient.subTopic("world/test1", 1);
        mqttClient.pubMessage(1, "world/test1", "hello:test_1");
        SpringApplication.run(IotMqttMain.class, args);
    }
}
